package com.sumainfor.pc.gmio.controller;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.pc.gmio.service.impl.market.BillOwnerService;
import com.sumainfor.pc.gmio.service.impl.market.ManagerService;
import com.sumainfor.pc.gmio.service.impl.tenant.BillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 功能描述:
 *
 * @Auther: zhlu
 * @Date: 2019/4/28 13:47
 * @Description:
 */
@RestController
@RequestMapping("/test")
public class test {

    @Autowired
    BillService BillService;

    @Autowired
    ManagerService ManagerService;

    @Autowired
    BillOwnerService BillOwnerService;

    @GetMapping("/getTrenantBill")
    public JsonResult getTrenantBill(@RequestParam Map<String,Object> params){
        JsonResult result=new JsonResult();
        return result.put(BillService.getTrenantBill(params));
    }

    /**
     * 功能描述:
     * 根据业主合同资料生成唐巢支付业主的账单
     * 1.新业主收房信息补全之前生成。
     * 2.续签业主在第一份合同到期之后定时任务生成
     *
     * @Author zhlu
     * @Description //TODO
     * @Date 2019/3/25 10:42
     */
    @ResponseBody
    @PostMapping("/AddBillOwner")
    public JsonResult AddBillOwner(@RequestBody Map<String, Object> params) throws Exception {
        JsonResult result = new JsonResult();
        if (BillOwnerService.AddBillOwner(params)) {
            result.putSuccess("业主账单录入成功！");
        } else {
            result.putFailed("服务器繁忙，请稍后重试！");
        }
        return result;
    }


    @RequestMapping(value = "/getManagerGmioCountList",method = RequestMethod.GET)
    public JsonResult getManagerGmioCountList(@RequestParam Map<String,Object>params){
        JsonResult result=new JsonResult();
        return result.put(ManagerService.getManagerGmioCount(params));
    }

}
